//
// Created by Administrator on 2023-9-4.
// 纯用位运算实现整数加法
// https://leetcode.cn/problems/add-without-plus-lcci/description/
//

#include <iostream>

using namespace std;

int add (int a, int b)
{
    // 这里要赋值, 防止b==0
    int aa=a;
    while(b)
    {
        aa = a^b;
        b = (a&b)<<1;
        a = aa;
    }
    return aa;
}
int main()
{
    int one = 59,two = 23;
    cout<<add(one,two);
    return 0;
}